# Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance with the License. You may obtain a copy of the
# License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

cc_library(
    name = "override_flag",
    srcs = ["override_flag.cc"],
    hdrs = ["override_flag.h"],
    visibility = ["//visibility:public"],
    deps = [
        "//flare/base:logging",
        "//flare/base:never_destroyed",
        "//flare/base/internal:macro",
        "@com_github_gflags_gflags//:gflags",
        "@com_github_google_glog//:glog",
    ],
)

cc_test(
    name = "override_flag_test",
    srcs = ["override_flag_test.cc"],
    deps = [
        ":override_flag",
        "//flare/testing:main",
        "@com_github_gflags_gflags//:gflags",
    ],
)

cc_library(
    name = "on_init",
    srcs = ["on_init.cc"],
    hdrs = ["on_init.h"],
    visibility = ["//visibility:public"],
    deps = [
        "//flare/base:function",
        "//flare/base:logging",
        "//flare/base:never_destroyed",
        "//flare/base:random",
        "//flare/base/internal:macro",
    ],
)

cc_test(
    name = "on_init_test",
    srcs = ["on_init_test.cc"],
    deps = [
        ":on_init",
        "//flare/testing:main",
    ],
)

cc_library(
    name = "openssl_initializer",
    srcs = ["openssl_initializer.cc"],
    hdrs = [],
    visibility = ["//visibility:public"],
    deps = [
        ":on_init",
        "//flare/io/util:openssl",
    ],
    alwayslink = True,
)

cc_library(
    name = "override_rlimit",
    srcs = ["override_rlimit.cc"],
    hdrs = [],
    visibility = ["//visibility:public"],
    deps = [
        ":on_init",
        "//flare/base:logging",
        "//flare/base:string",
        "@com_github_gflags_gflags//:gflags",
    ],
    alwayslink = True,
)

cc_test(
    name = "override_rlimit_test",
    srcs = ["override_rlimit_test.cc"],
    deps = [
        ":override_flag",
        ":override_rlimit",
        "//flare/base:logging",
        "//flare/testing:main",
    ],
)
